package com.mv.springmvc.view;

import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
import org.thymeleaf.templateresolver.FileTemplateResolver;

public class View {
	
	private FileTemplateResolver re;
	private TemplateEngine te;


    private View(){
    	re = new FileTemplateResolver();
		re.setTemplateMode("html");
        re.setCharacterEncoding("UTF-8");
        
		te = new TemplateEngine();
        te.setTemplateResolver(re);
    }
    private static class SingletonClassInstance{
        private static final View instance=new View();
    }
    public static View getInstance(){
        return SingletonClassInstance.instance;
    }
    
	public static String show(String page, Context ctx){
		return getInstance().te.process(page,ctx);
	}
	
}


